<extend name="_layout/main"/>
<block name="head">
    <style>
        .mid {
            text-align: center;
            font-weight: bold;
        }
        #user_avatar{
            display: none;
        }
    </style>
</block>
<block name="top">
    <header class="mui-bar mui-bar1 mui-bar-nav mui-bar-nav1" id="header">
        <!--<a class="btn" href="javascript:history.go(-1)">-->
        <!--<i class="iconfont icon-fanhui"></i>-->
        <!--</a>-->
        <div class="top-sch-box top-sch-boxtwo top-sch-boxthree flex-col mid">
            会员中心
        </div>
    </header>
</block>
<block name="content">
    <div class="warp clearfloat">
        <div class="h-top clearfloat box-s">
            <div class="tu clearfloat fl">
                <img id="avatar" src="{$user_info.avatar|default='/Public/static/img/touxiang.png'}"/>
                <input type="file" id="user_avatar" name="thumb" />
            </div>
            <div class="content clearfloat fl">
                <p class="hname">{$user_info.nickname}【ID:{$user_info.id}】</p>
                <p class="htel">{$user_info.mobile|default='暂未绑定'}</p>
                <p class="hpthy">{:userIdentity($user_info['identity'])}</p>
            </div>
            <eq name="signed" value="0">
                <a href="javascript:void(0)" id="btn-sign" class="btn db clearfloat fr ra3">签到</a>
                <else/>
                <a href="javascript:void(0)" class="btn db clearfloat fr ra3">已签</a>
            </eq>

        </div>
        <div class="cash clearfloat">
            <div class="shang clearfloat">
                <ul>
                    <li>
                        <a href="javascript:void(0)">
                            <p>{$wealth.balance}</p>
                            <span>现金余额</span>
                        </a>
                    </li>
                    <li>
                        <a href="javascript:void(0)">
                            <p>{$wealth.integral}</p>
                            <span>可用积分</span>
                        </a>
                    </li>
                    <li>
                        <a href="javascript:void(0)">
                            <p>{$wealth.stored_integral}</p>
                            <span>待用积分</span>
                        </a>
                    </li>
                </ul>
            </div>
            <div class="shang xia clearfloat">
                <ul>
                    <li>
                        <a href="javascript:void(0)">
                            <p>{$wealth.coupon}</p>
                            <span>商品券</span>
                        </a>
                    </li>
                    <li>
                        <a href="javascript:void(0)">
                            <p>{$wealth['integral'] - $wealth['unstore_integral']}</p>
                            <span>可倍增积分额值</span>
                        </a>
                    </li>
                </ul>
            </div>
        </div>
        <div class="cashlist clearfloat">
            <ul>
                <li class="box-s">
                    <a href="{:U('Balance/index')}">
                        <p class="fl">现金账户管理</p>
                        <i class="iconfont icon-jiantou1 fr"></i>
                    </a>
                </li>
                <in name="user_info.identity" value="99,109">
                    <li class="box-s">
                        <a href="{:U('Pay/index')}">
                            <p class="fl">现金充值</p>
                            <i class="iconfont icon-jiantou1 fr"></i>
                        </a>
                    </li>
                </in>
                <gt name="user_info.identity" value="0">
                <li class="box-s">
                    <a href="{:U('Balance/transfer')}">
                        <p class="fl">现金转账</p>
                        <i class="iconfont icon-jiantou1 fr"></i>
                    </a>
                </li>
                </gt>
            </ul>
        </div>
        <div class="cashlist clearfloat">
            <ul>
                <li class="box-s">
                    <a href="{:U('Integral/index')}">
                        <p class="fl">可用积分管理</p>
                        <i class="iconfont icon-jiantou1 fr"></i>
                    </a>
                </li>
                <li class="box-s">
                    <a href="{:U('Integral/stored')}">
                        <p class="fl">待用积分管理</p>
                        <i class="iconfont icon-jiantou1 fr"></i>
                    </a>
                </li>
                <gt name="user_info.identity" value="0">
                <li class="box-s">
                    <a href="{:U('Integral/tostore')}">
                        <p class="fl">可用转待用</p>
                        <i class="iconfont icon-jiantou1 fr"></i>
                    </a>
                </li>
                <li class="box-s">
                    <a href="{:U('Integral/transfer')}">
                        <p class="fl">可用积分转账</p>
                        <i class="iconfont icon-jiantou1 fr"></i>
                    </a>
                </li>
                </gt>
            </ul>
        </div>
        <div class="cashlist clearfloat">
            <ul>
                <li class="box-s">
                    <a href="{:U('Coupon/index')}">
                        <p class="fl">商品券管理</p>
                        <i class="iconfont icon-jiantou1 fr"></i>
                    </a>
                </li>
                <gt name="user_info.identity" value="0">
                <li class="box-s">
                    <a href="{:U('Coupon/transfer')}">
                        <p class="fl">商品券转账</p>
                        <i class="iconfont icon-jiantou1 fr"></i>
                    </a>
                </li>
                </gt>
            </ul>
        </div>
        <div class="cashlist clearfloat">
            <ul>
                <eq name="user_info.identity" value="9">
                    <li class="box-s">
                        <a href="{:U('apply_supplier')}">
                            <p class="fl">申请联盟商家</p>
                            <i class="iconfont icon-jiantou1 fr"></i>
                        </a>
                    </li>
                </eq>
                <in name="user_info.identity" value="99,109">
                    <li class="box-s">
                        <a href="{:U('apply_operations')}">
                            <p class="fl">申请运营中心</p>
                            <i class="iconfont icon-jiantou1 fr"></i>
                        </a>
                    </li>
                    <li class="box-s">
                        <a href="{:U('apply_active')}">
                            <p class="fl">我要报单</p>
                            <i class="iconfont icon-jiantou1 fr"></i>
                        </a>
                    </li>
                    <li class="box-s">
                        <a href="{:U('apply_renewal')}">
                            <p class="fl">我要追加单</p>
                            <i class="iconfont icon-jiantou1 fr"></i>
                        </a>
                    </li>
                    <li class="box-s">
                        <a href="{:U('active_list')}">
                            <p class="fl">报单记录</p>
                            <i class="iconfont icon-jiantou1 fr"></i>
                        </a>
                    </li>
                    <li class="box-s">
                        <a href="{:U('renewal_list')}">
                            <p class="fl">追加单记录</p>
                            <i class="iconfont icon-jiantou1 fr"></i>
                        </a>
                    </li>
                </in>
                <li class="box-s">
                    <a href="{:U('goods_order')}">
                        <p class="fl">消费订单管理</p>
                        <i class="iconfont icon-jiantou1 fr"></i>
                    </a>
                </li>
                <li class="box-s">
                    <a href="{:U('friends')}">
                        <p class="fl">我的好友</p>
                        <i class="iconfont icon-jiantou1 fr"></i>
                    </a>
                </li>
                <li class="box-s">
                    <a href="{:U('update_password')}">
                        <p class="fl">修改密码</p>
                        <i class="iconfont icon-jiantou1 fr"></i>
                    </a>
                </li>
                <!--<li class="box-s">-->
                <!--<a href="xiugainame.html">-->
                <!--<p class="fl">修改姓名</p>-->
                <!--<i class="iconfont icon-jiantou1 fr"></i>-->
                <!--</a>-->
                <!--</li>-->
            </ul>
        </div>
        <a href="{:U('Login/logout')}" class="center-btn db ra3">退出登录</a>
    </div>
    <!--<include file="_layout/footer"/>-->
    <footer class="page-footer fixed-footer" id="footer">
        <ul>
            <li>
                <a href="{:U('Index/index')}">
                    <i class="iconfont icon-shouye"></i>
                    <p>商城</p>
                </a>
            </li>
            <li>
                <a href="{:U('invite/show',['id'=>$user_info['id']])}">
                    <i class="iconfont icon-erweima1"></i>
                    <p>二维码</p>
                </a>
            </li>
            <li>
                <a href="#">
                    <i class="iconfont icon-kefu1"></i>
                    <p>客服</p>
                </a>
            </li>
            <li class="active">
                <a href="{:U('Member/index')}">
                    <i class="iconfont icon-yonghuming"></i>
                    <p>我的</p>
                </a>
            </li>
        </ul>
    </footer>
</block>
<block name="scripts">
    <script src="http://api.map.baidu.com/api?v=1.3" type="text/javascript"></script>
    <script>
        $(document).on('click', '#btn-sign', function (e) {
            var _this = $(this);
            e.preventDefault();
            $.get("{:U('sign')}", {}, function (xdata) {
                mui.toast(xdata.message);
                if (xdata.status == 'success') {
                    _this.html('已签');
                }
            }, 'json');
        })
        window.addEventListener('load', function(){
            setTimeout(function(){
                $.post("{:U('Task/bank')}", {}, function(xdata){

                });
            }, 2000);
        })

        if (window.navigator.geolocation) {
            var options = {
                enableHighAccuracy: true,
            };
            window.navigator.geolocation.getCurrentPosition(handleSuccess, handleError, options);
        } else {
            alert("浏览器不支持html5来获取地理位置信息");
        }

        function handleSuccess(position) {
            // 获取到当前位置经纬度  本例中是chrome浏览器取到的是google地图中的经纬度
            var lng = position.coords.longitude;
            var lat = position.coords.latitude;
            // 调用百度地图api显示
            var map = new BMap.Map("map");
            var ggPoint = new BMap.Point(lng, lat);

            var gc = new BMap.Geocoder();
            gc.getLocation(ggPoint, function (rs) {
                var addComp = rs.addressComponents;
                $("#city").html(addComp.city);
                if (addComp.city != '') {
                    $.post("{:U('Location/set_city')}", {city: addComp.city}, function () {

                    }, 'json');
                }
                //console.log(addComp.province + ", " + addComp.city + ", " + addComp.district + ", " + addComp.street + ", " + addComp.streetNumber);
            });

        }

        function handleError(error) {

        }
    </script>
</block>
